package com.baosight.risk.service.xtzy.impl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baosight.risk.api.xtzy.IXtzyCompRoleService;
import com.baosight.risk.base.mapper.BaseMapper;
import com.baosight.risk.base.service.BaseServiceImpl;
import com.baosight.risk.common.bean.BeanUtils;
import com.baosight.risk.mapper.xtzy.XtzyCompRoleMapper;
import com.baosight.risk.service.xtzy.entity.XtzyCompRole;

import lombok.extern.slf4j.Slf4j;

/**
 * 
 * @author zzw
 *
 */
@Service
@Slf4j
public class IXtzyCompRoleServiceImpl extends BaseServiceImpl<XtzyCompRole> implements IXtzyCompRoleService {
    @Autowired
    private XtzyCompRoleMapper compRoleMapper;

    @Override
    public BaseMapper getMapper() {
        return compRoleMapper;
    }

	@Override
	public int save(XtzyCompRole compRole) {
		if(StringUtils.isBlank(compRole.getId())){
			compRole = (XtzyCompRole) BeanUtils.initBean(compRole);
			return this.insert(compRole);
		}else{
			return this.update(compRole);
		}
	}

}
